@ GNU AS assembler header file for Draw
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:50:43 2012
@ Jonathan Coxhead, jonathan@doves.demon.co.uk, 21 Aug 1995

@ OSLib---efficient, type-safe, transparent, extensible,
@ register-safe API coverage of RISC OS
@ 
@ Copyright (c) 1994-2012 Jonathan Coxhead and OSLib maintainers
@ 
@ Licence:
@ 
@    OSLib is free software; you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation; either version 1, or (at your option)
@ any later version - and this with the following clarification and
@ special exception:
@ 
@    Linking this library statically or dynamically with other modules
@ is making a combined work based on this library. Thus, the terms
@ and conditions of the GNU General Public License cover the whole
@ combination.
@ 
@    As a special exception, the copyright holders of this library
@ give you permission to link this library with independent modules
@ to produce an executable, regardless of the license terms of these
@ independent modules, and to copy and distribute the resulting
@ executable under terms of your choice, provided that you also meet,
@ for each linked independent module, the terms and conditions of the
@ license of that module. An independent module is a module which is
@ not derived from or based on this library. If you modify this
@ library, you may extend this exception to your version of the library,
@ but you are not obliged to do so. If you do not wish to do so, delete
@ this exception statement from your version.
@ 
@    OSLib is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@ GNU General Public License for more details.
@ 
@    You should have received a copy of the GNU General Public License
@ along with this programme; if not, write to the Free Software
@ Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, USA.

#ifndef Draw_Hdr
#  define Draw_Hdr

#  ifndef Get_Types
#    define Get_Types
#    include "oslib/Types.Hdr"
#  endif

#  ifndef Get_OS
#    define Get_OS
#    include "oslib/OS.Hdr"
#  endif

@Symbols for constants
#  define Draw_OSUnit 0x100
#  define Draw_Inch 0xb400
#  define Draw_Point 0x280
#  define Draw_EndPath 0x0
#  define Draw_Continuation 0x1
#  define Draw_MoveTo 0x2
#  define Draw_SpecialMoveTo 0x3
#  define Draw_CloseGap 0x4
#  define Draw_CloseLine 0x5
#  define Draw_BezierTo 0x6
#  define Draw_GapTo 0x7
#  define Draw_LineTo 0x8
#  define Draw_FillNonzero 0x0
#  define Draw_FillNegative 0x1
#  define Draw_FillEvenOdd 0x2
#  define Draw_FillPositive 0x3
#  define Draw_FillWindingRuleShift 0x0
#  define Draw_FillWindingRule 0x3
#  define Draw_FillFullExterior 0x4
#  define Draw_FillExteriorBoundary 0x8
#  define Draw_FillInteriorBoundary 0x10
#  define Draw_FillFullInterior 0x20
#  define Draw_FillOutputBBox 0x2000000
#  define Draw_Fill32BitClean 0x4000000
#  define Draw_FillCloseOpenSubpaths 0x8000000
#  define Draw_FillFlatten 0x10000000
#  define Draw_FillThicken 0x20000000
#  define Draw_FillReflatten 0x40000000
#  define Draw_FillFloat 0x80000000
#  define Draw_JoinMitred 0x0
#  define Draw_JoinRound 0x1
#  define Draw_JoinBevelled 0x2
#  define Draw_CapButt 0x0
#  define Draw_CapRound 0x1
#  define Draw_CapSquare 0x2
#  define Draw_CapTriangular 0x3
#  define Draw_SpecialInSitu 0x0
#  define Draw_SpecialFill 0x1
#  define Draw_SpecialFillBySubpaths 0x2
#  define Draw_SpecialCount 0x3
#  define Draw_SpecialBBox 0x80000000
#  define Error_DrawNoDrawInIRQMode 0x980
#  define Error_DrawBadDrawReasonCode 0x981
#  define Error_DrawReservedDrawBits 0x982
#  define Error_DrawInvalidDrawAddress 0x983
#  define Error_DrawBadPathElement 0x984
#  define Error_DrawBadPathSequence 0x985
#  define Error_DrawMayExpandPath 0x986
#  define Error_DrawPathFull 0x987
#  define Error_DrawPathNotFlat 0x988
#  define Error_DrawBadCapsOrJoins 0x989
#  define Error_DrawTransformOverflow 0x98a
#  define Error_DrawDrawNeedsGraphicsMode 0x98b
#  define Error_DrawUnimplementedDraw 0x9ff
#  define DrawV_ProcessPath 0x0
#  define DrawV_Fill 0x2
#  define DrawV_Stroke 0x4
#  define DrawV_StrokePath 0x6
#  define DrawV_FlattenPath 0x8
#  define DrawV_TransformPath 0xa
#  define DrawV_FillClipped 0xc
#  define DrawV_StrokeClipped 0xe

@Symbols for structure offsets and sizes
        .struct 0
        .skip   Byte
Draw_Tag                       : 

        .struct 0
        .skip   Bits
Draw_FillStyle                 : 

        .struct 0
        .skip   Byte
Draw_JoinStyle                 : 

        .struct 0
        .skip   Byte
Draw_CapStyle                  : 

        .struct 0
        .skip   Ptr
Draw_OutputPath                : 

        .struct 0
Draw_PathElement_tag           : .skip   Draw_Tag
Draw_PathElement_reserved      : .skip   3*Byte
Draw_PathElement_data          : 
Draw_PathElement_data_end_path : .skip   Int
        .struct Draw_PathElement_data
Draw_PathElement_data_continuation: .skip   Ptr
        .struct Draw_PathElement_data
Draw_PathElement_data_move_to  : .skip   OS_Coord
        .struct Draw_PathElement_data
Draw_PathElement_data_special_move_to: .skip   OS_Coord
        .struct Draw_PathElement_data
Draw_PathElement_data_bezier_to: .skip   OS_Coord
        .struct Draw_PathElement_data
Draw_PathElement_data_gap_to   : .skip   OS_Coord
        .struct Draw_PathElement_data
Draw_PathElement_data_line_to  : .skip   OS_Coord
        .struct Draw_PathElement_data
Draw_PathElement_data_reserved : .skip   24*Byte
Draw_PathElement               : 

        .struct 0
Draw_LineStyle_join_style      : .skip   Draw_JoinStyle
Draw_LineStyle_end_cap_style   : .skip   Draw_CapStyle
Draw_LineStyle_start_cap_style : .skip   Draw_CapStyle
Draw_LineStyle_reserved        : .skip   Byte
Draw_LineStyle_mitre_limit     : .skip   Int
Draw_LineStyle_start_cap_width : .skip   Short
Draw_LineStyle_start_cap_length: .skip   Short
Draw_LineStyle_end_cap_width   : .skip   Short
Draw_LineStyle_end_cap_length  : .skip   Short
Draw_LineStyle                 : 

        .struct 0
Draw_DashPattern_start         : .skip   Int
Draw_DashPattern_element_count : .skip   Int
Draw_DashPattern_elements      : .skip   Int
Draw_DashPattern               : 
        
        .altmacro
        .macro  Draw_DashPattern_MEMBERS label
\label&_start                  : .skip   Int
\label&_element_count          : .skip   Int
        .endm
        
        .struct 0
        Draw_DashPattern_MEMBERS Draw_DashPatternBase
Draw_DashPatternBase           : 

        .struct 0
Draw_Path_elements             : .skip   Draw_PathElement
Draw_Path                      : 

        .struct 0
Draw_ClipDescriptor_path       : .skip   Ptr
Draw_ClipDescriptor_fill_style : .skip   Draw_FillStyle
Draw_ClipDescriptor_trfm       : .skip   OS_Trfm
Draw_ClipDescriptor            : 

        .struct 0
        .skip   Int
DrawV_Reason                   : 


@Symbols for SWI's and SWI reason codes
.set XDraw_ProcessPath,0x60700
.set Draw_ProcessPath,0x40700
   @Entry
   @  R0 -> path (Draw_Path)
   @  R1 = fill_style (Draw_FillStyle)
   @  R2 -> trfm (OS_Trfm)
   @  R3 = flatness (Int)
   @  R4 = thickness (Int)
   @  R5 -> line_style (Draw_LineStyle)
   @  R6 -> dash_pattern (Draw_DashPattern)
   @  R7 = processed_path (Draw_OutputPath)
   @Exit
   @  R0 = end_or_used (pointer to data)

.set XDraw_Fill,0x60702
.set Draw_Fill,0x40702
   @Entry
   @  R0 -> path (Draw_Path)
   @  R1 = fill_style (Draw_FillStyle)
   @  R2 -> trfm (OS_Trfm)
   @  R3 = flatness (Int)

.set XDraw_Stroke,0x60704
.set Draw_Stroke,0x40704
   @Entry
   @  R0 -> path (Draw_Path)
   @  R1 = fill_style (Draw_FillStyle)
   @  R2 -> trfm (OS_Trfm)
   @  R3 = flatness (Int)
   @  R4 = thickness (Int)
   @  R5 -> line_style (Draw_LineStyle)
   @  R6 -> dash_pattern (Draw_DashPattern)

.set XDraw_StrokePath,0x60706
.set Draw_StrokePath,0x40706
   @Entry
   @  R0 -> path (Draw_Path)
   @  R1 = stroked_path (pointer to Draw_Path)
   @  R2 -> trfm (OS_Trfm)
   @  R3 = flatness (Int)
   @  R4 = thickness (Int)
   @  R5 -> line_style (Draw_LineStyle)
   @  R6 -> dash_pattern (Draw_DashPattern)
   @Exit
   @  R0 = end_or_used (pointer to data)

.set XDraw_FlattenPath,0x60708
.set Draw_FlattenPath,0x40708
   @Entry
   @  R0 -> path (Draw_Path)
   @  R1 = flattened_path (pointer to Draw_Path)
   @  R2 = flatness (Int)
   @Exit
   @  R0 = end_or_used (pointer to data)

.set XDraw_TransformPath,0x6070a
.set Draw_TransformPath,0x4070a
   @Entry
   @  R0 -> path (Draw_Path)
   @  R1 = transformed_path (pointer to Draw_Path)
   @  R2 -> trfm (OS_Trfm)
   @  R3 = &0
   @Exit
   @  R0 = end_or_used (pointer to data)

.set XDraw_FillClipped,0x6070c
.set Draw_FillClipped,0x4070c
   @Entry
   @  R0 -> path (Draw_Path)
   @  R1 = fill_style (Draw_FillStyle)
   @  R2 -> trfm (OS_Trfm)
   @  R3 = flatness (Int)
   @  R4 -> clip_descriptor (Draw_ClipDescriptor)

.set XDraw_StrokeClipped,0x6070e
.set Draw_StrokeClipped,0x4070e
   @Entry
   @  R0 -> path (Draw_Path)
   @  R1 = fill_style (Draw_FillStyle)
   @  R2 -> trfm (OS_Trfm)
   @  R3 = flatness (Int)
   @  R4 = thickness (Int)
   @  R5 -> line_style (Draw_LineStyle)
   @  R6 -> dash_pattern (Draw_DashPattern)
   @  R7 -> clip_descriptor (Draw_ClipDescriptor)

#  define DrawV 0x20

#endif
